package com.hava.pipeline.toolbox.gui.tray;

import com.hava.pipeline.toolbox.gui.tray.icon.DesktopSystemTrayIcon;
import com.hava.pipeline.toolbox.gui.tray.menu.DesktopSystemTrayPopupMenu;
import com.hava.utils.exception.DeveloperException;
import com.hava.utils.pattern.SingletonManager;

import java.awt.*;

public class DesktopSystemTray {

    public DesktopSystemTray() throws DeveloperException {

        SystemTray systemTray = SystemTray.getSystemTray();

        DesktopSystemTrayIcon trayIcon = SingletonManager.getInstance(DesktopSystemTrayIcon.class);
        DesktopSystemTrayPopupMenu menu = SingletonManager.getInstance(DesktopSystemTrayPopupMenu.class);

        trayIcon.setPopupMenu(menu);

        try {
            systemTray.add(trayIcon.getTrayIcon());
        } catch (AWTException e) {
            e.printStackTrace();
        }
    }
}
